import $store from "@/store";
import {message} from 'ant-design-vue';

export function getRoute(id) {
  const routeTable = $store.state.userInfo.routeAll
  const role_id = $store.state.userInfo.role_id
  let route = ""

  routeTable.forEach(x => {
    if (x.id === id) {
      route = x
    }
  })
  if (route === "") {
    if (role_id === 1) {
      message.error("当前管理员没有访问权限")
    } else {
      // message.error("当前用户没有访问权限")
    }
  }
  return route
}